using System;
using Microsoft.SPOT;
using Marknic.TestRunner.Rigging;


namespace NetduinoRobot.Common
{
    public class CommandHelperTest
    {
        /// <summary>
        ///A test for updating boolean value by UpdateObject
        ///</summary>
        public void TestCreateEnvelope()
        {
            CommandHelper helper = new CommandHelper();
            string command = "test";
            string envelopedCommand = "<cmd len=00025>test</cmd>";
            string test = helper.CreateEnvelope(command);
            Assert.AreEqual(envelopedCommand, test);
        }

        public void TestSomeOtherCode()
        {
            string input = ">test</cmd>";
            byte[] cmdBuffer;
            string expectedOutput = "test";
            string output;
            int cmdEndTagLength = 6; //</cmd>

            cmdBuffer = System.Text.UTF8Encoding.UTF8.GetBytes(input);
            output = new String(System.Text.UTF8Encoding.UTF8.GetChars(cmdBuffer, 1, input.Length - 1 - cmdEndTagLength));
            Assert.AreEqual(expectedOutput, output);
        }
    }
}
